
public class test1 {
     interface Hobby {
        void enjoy();
    }

    // 实现Hobby接口的Reading类
    public class Reading implements Hobby {
        @Override
        public void enjoy() {
            System.out.println("我喜欢阅读书籍");
        }
    }

    // 测试类
    public class Main {
        public static void main(String[] args) {
            // 创建Reading对象
            Hobby reading = new Hobby() {
                @Override
                public void enjoy() {

                }
            };
            // 调用enjoy方法
            reading.enjoy();
        }
    }
}
